package com.xuxin.baby.network;

import com.xuxin.baby.bean.SignBean;
import com.xuxin.baby.bean.AuthenticateBean;
import com.xuxin.baby.bean.BannerBean;
import com.xuxin.baby.bean.BaseBean;
import com.xuxin.baby.bean.CategoryBean;
import com.xuxin.baby.bean.ChildDataBean;
import com.xuxin.baby.bean.ChildEatingBean;
import com.xuxin.baby.bean.ChildGreatBean;
import com.xuxin.baby.bean.ChildSicknessBean;
import com.xuxin.baby.bean.ChildSmellyBean;
import com.xuxin.baby.bean.ChildVaccineBean;
import com.xuxin.baby.bean.ChildVaccineHistoryBean;
import com.xuxin.baby.bean.DoctorBean;
import com.xuxin.baby.bean.DoctorsBean;
import com.xuxin.baby.bean.IsBuyBean;
import com.xuxin.baby.bean.KeywordsBean;
import com.xuxin.baby.bean.LoginBean;
import com.xuxin.baby.bean.NoticeBean;
import com.xuxin.baby.bean.OrderBean;
import com.xuxin.baby.bean.ReaderBean;
import com.xuxin.baby.bean.ReaderVideoBean;
import com.xuxin.baby.bean.ReportBean;
import com.xuxin.baby.bean.ServiceBean;
import com.xuxin.baby.bean.TenantIdBean;
import com.xuxin.baby.bean.UpdateBean;
import com.xuxin.baby.bean.UpdateOrderBean;
import com.xuxin.baby.bean.UploadFilesBean;
import com.xuxin.baby.bean.UserChildBean;
import com.xuxin.baby.bean.UserDataBean;
import com.xuxin.baby.bean.UserLikeBean;
import com.xuxin.baby.bean.UserProductBean;
import com.xuxin.baby.bean.UserTicketBean;
import com.xuxin.baby.bean.VideoBean;
import com.xuxin.baby.bean.VideoCollectedBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Response;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;

/**
 * Created by xu_xin
 * Created on 2020.06.05
 */
public interface RetrofitApi {
    /**
     * 测试
     */
    @GET("getData")
    Observable<Response<BaseBean>> getData();

    /**
     * 测试
     */
    @POST("/api/services/app/Edu_MyCoupon/Create")
    Observable<Response<BaseBean>> test(@Header("Abp.TenantId") String tenantId,
                                        @Header("Authorization") String token,
                                        @Header("Abp-TenantId") String AbpTenant,
                                        @Body RequestBody requestBody);

    /**
     * 上传图片
     * objectId 对象id(memberId，childId)
     * objectName 对象的名称(比如宝宝那就是Edu_Children)
     * objectField 具体的字段，宝宝头像就是avatar
     */
    @Multipart
    @POST("/Home/UploadFilesAsync")
    Observable<Response<UploadFilesBean>> uploadFiles(@Header("Abp.TenantId") String tenantId,
                                                      @Header("Authorization") String token,
                                                      @Header("Abp-TenantId") String AbpTenant,
                                                      @Query("objectId") String objectId,
                                                      @Query("objectName") String objectName,
                                                      @Query("objectField") String objectField,
                                                      @Part() List<MultipartBody.Part> parts);

    /**
     * 获取更新接口
     */
    @GET("api/services/app/Edu_Config/GetAppCfg")
    Observable<Response<UpdateBean>> getUpdate(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant);

    /**
     * -------------------登录------------------
     * <p>
     * 获取验证码
     */
    @FormUrlEncoded
    @POST("/api")
    Observable<Response<BaseBean>> sendCode(@Header("Abp-TenantId") String AbpTenant,
                                            @Field("phone") String phone,
                                            @Field("code") String code);

    /**
     * 租户接口
     */
    @POST("/api/services/app/Account/IsTenantAvailable")
    Observable<Response<TenantIdBean>> getTenantId(@Header("Abp-TenantId") String AbpTenant,
                                                   @Body RequestBody requestBody);

    /**
     * API授权
     */
    @POST("/api/TokenAuth/Authenticate")
    Observable<Response<AuthenticateBean>> authenticate(@Header("Abp.TenantId") String tenantId,
                                                        @Header("Abp-TenantId") String AbpTenant,
                                                        @Body RequestBody requestBody);

    /**
     * 登录(未注册自动注册登录)
     */
    @POST("/api/services/app/Members/MobileLogin")
    Observable<Response<LoginBean>> login(@Header("Abp.TenantId") String tenantId,
                                          @Header("Authorization") String token,
                                          @Header("Abp-TenantId") String AbpTenant,
                                          @Query("mobile") String phone);

    /**
     * 查询授权用户信息
     */
    @GET("api/services/app/Session/GetCurrentLoginInformations")
    Observable<Response<ResponseBody>> getInfo(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant);

    /**
     * -------------------首页------------------
     * <p>
     * 轮播图
     */
    @GET("/api/services/app/Advertisement/GetList")
    Observable<Response<BannerBean>> getBanner(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant);

    /**
     * 宝宝大事记、最新动态
     */
    @GET("/api/services/app/Edu_EventChild/GetList")
    Observable<Response<ChildGreatBean>> getChildGreat(@Header("Abp.TenantId") String tenantId,
                                                       @Header("Authorization") String token,
                                                       @Header("Abp-TenantId") String AbpTenant,
                                                       @Query("childId") String childId,
                                                       @Query("eType") String eventType,
                                                       @Query("skipCount") int skipCount,
                                                       @Query("maxResultCount") int maxResultCount);

    /**
     * 更新城市
     */
    @PUT("api/services/app/Members/UpdateCity")
    Observable<Response<BaseBean>> updateCity(@Header("Abp.TenantId") String tenantId,
                                              @Header("Authorization") String token,
                                              @Header("Abp-TenantId") String AbpTenant,
                                              @Query("memberId") String memberId,
                                              @Query("city") String city);

    /**
     * 热门搜索
     */
    @GET("api/services/app/Edu_KeywordLib/GetList")
    Observable<Response<KeywordsBean>> getKeywords(@Header("Abp.TenantId") String tenantId,
                                                   @Header("Authorization") String token,
                                                   @Header("Abp-TenantId") String AbpTenant,
                                                   @Query("memberId") String memberId);

    /**
     * 身高体重头围、睡眠列表
     * 身高体重头围、睡眠列表 eventType=basic 获取身高体重头围；eventType=sleep 获取睡眠；
     */
    @GET("/api/services/app/Edu_EventGrowth/GetList")
    Observable<Response<ChildDataBean>> getChildData(@Header("Abp.TenantId") String tenantId,
                                                     @Header("Authorization") String token,
                                                     @Header("Abp-TenantId") String AbpTenant,
                                                     @Query("childId") String childId,
                                                     @Query("eType") String eventType,
                                                     @Query("skipCount") int skipCount,
                                                     @Query("maxResultCount") int maxResultCount);

    /**
     * 记录身高体重头围、睡眠
     */
    @POST("/api/services/app/Edu_EventGrowth/Create")
    Observable<Response<BaseBean>> recordChildData(@Header("Abp.TenantId") String tenantId,
                                                   @Header("Authorization") String token,
                                                   @Header("Abp-TenantId") String AbpTenant,
                                                   @Body RequestBody requestBody);

    /**
     * 臭臭列表
     */
    @GET("/api/services/app/Edu_EventShit/GetList")
    Observable<Response<ChildSmellyBean>> getChildSmelly(@Header("Abp.TenantId") String tenantId,
                                                         @Header("Authorization") String token,
                                                         @Header("Abp-TenantId") String AbpTenant,
                                                         @Query("childId") String childId,
                                                         @Query("skipCount") int skipCount,
                                                         @Query("maxResultCount") int maxResultCount);

    /**
     * 记录臭臭
     */
    @POST("/api/services/app/Edu_EventShit/Create")
    Observable<Response<BaseBean>> recordChildSmelly(@Header("Abp.TenantId") String tenantId,
                                                     @Header("Authorization") String token,
                                                     @Header("Abp-TenantId") String AbpTenant,
                                                     @Body RequestBody requestBody);

    /**
     * 喂养列表
     */
    @GET("/api/services/app/Edu_EventFeed/GetList")
    Observable<Response<ChildEatingBean>> getChildEating(@Header("Abp.TenantId") String tenantId,
                                                         @Header("Authorization") String token,
                                                         @Header("Abp-TenantId") String AbpTenant,
                                                         @Query("childId") String childId,
                                                         @Query("skipCount") int skipCount,
                                                         @Query("maxResultCount") int maxResultCount);

    /**
     * 记录喂养
     */
    @POST("/api/services/app/Edu_EventFeed/Create")
    Observable<Response<BaseBean>> recordChildEating(@Header("Abp.TenantId") String tenantId,
                                                     @Header("Authorization") String token,
                                                     @Header("Abp-TenantId") String AbpTenant,
                                                     @Body RequestBody requestBody);

    /**
     * 宝宝看病记录列表
     */
    @GET("/api/services/app/Edu_EventChild/GetList")
    Observable<Response<ChildSicknessBean>> getChildSickness(@Header("Abp.TenantId") String tenantId,
                                                             @Header("Authorization") String token,
                                                             @Header("Abp-TenantId") String AbpTenant,
                                                             @Query("childId") String childId,
                                                             @Query("eType") String eventType,
                                                             @Query("skipCount") int skipCount,
                                                             @Query("maxResultCount") int maxResultCount);

    /**
     * 记录大事记和病历
     * 记录大事记和病历，大事记固定值：basic，看病记录固定值：medical
     */
    @POST("/api/services/app/Edu_EventChild/Create")
    Observable<Response<BaseBean>> recordChildGreat(@Header("Abp.TenantId") String tenantId,
                                                    @Header("Authorization") String token,
                                                    @Header("Abp-TenantId") String AbpTenant,
                                                    @Body RequestBody requestBody);

    /**
     * 疫苗接口
     */
    @GET("/api/services/app/Edu_Vaccines/GetList")
    Observable<Response<ChildVaccineBean>> getChildVaccine(@Header("Abp.TenantId") String tenantId,
                                                           @Header("Authorization") String token,
                                                           @Header("Abp-TenantId") String AbpTenant,
                                                           @Query("skipCount") int skipCount,
                                                           @Query("maxResultCount") int maxResultCount);

    /**
     * 疫苗历史
     */
    @GET("api/services/app/Edu_VaccinationHistory/getList")
    Observable<Response<ChildVaccineHistoryBean>> getChildVaccineHistory(@Header("Abp.TenantId") String tenantId,
                                                                         @Header("Authorization") String token,
                                                                         @Header("Abp-TenantId") String AbpTenant,
                                                                         @Query("childId") String childId,
                                                                         @Query("skipCount") int skipCount,
                                                                         @Query("maxResultCount") int maxResultCount);

    /**
     * 接种接口
     */
    @POST("/api/services/app/Edu_VaccinationHistory/Create")
    Observable<Response<BaseBean>> inoculate(@Header("Abp.TenantId") String tenantId,
                                             @Header("Authorization") String token,
                                             @Header("Abp-TenantId") String AbpTenant,
                                             @Body RequestBody requestBody);

    /**
     * 获取专家列表
     */
    @GET("/api/services/app/Edu_Doctors/GetList")
    Observable<Response<DoctorBean>> getDoctor(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant,
                                               @Query("skipCount") int skipCount,
                                               @Query("maxResultCount") int maxResultCount);

    /**
     * 获取专家详情
     */
    @GET("/api/services/app/Edu_Doctors/Get")
    Observable<Response<DoctorsBean>> getDoctors(@Header("Abp.TenantId") String tenantId,
                                                 @Header("Authorization") String token,
                                                 @Header("Abp-TenantId") String AbpTenant,
                                                 @Query("id") String id);

    /**
     * -------------------精英早教------------------
     * <p>
     * 精英早教分类
     */
    @GET("/api/services/app/Category/GetTreeListAsync")
    Observable<Response<CategoryBean>> getCategory(@Header("Abp.TenantId") String tenantId,
                                                   @Header("Authorization") String token,
                                                   @Header("x") String AbpTenant,
                                                   @Query("layout") String layout,
                                                   @Query("parentId") String parentId);

    /**
     * 视频文章
     */
    @GET("/api/services/app/Edu_Course/GetList")
    Observable<Response<ReaderVideoBean>> getReaderVideo(@Header("Abp.TenantId") String tenantId,
                                                         @Header("Authorization") String token,
                                                         @Header("Abp-TenantId") String AbpTenant,
                                                         @Query("cateid") String categoryId,
                                                         @Query("keywords") String keywords,
                                                         @Query("isRec") String isRec,
                                                         @Query("cType") String cType,
                                                         @Query("ageRge") String ageRge,
                                                         @Query("skipCount") int skipCount,
                                                         @Query("maxResultCount") int maxResultCount);

    /**
     * 课程详情
     */
    @GET("/api/services/app/Edu_Course/Get")
    Observable<Response<VideoBean>> getVideo(@Header("Abp.TenantId") String tenantId,
                                             @Header("Authorization") String token,
                                             @Header("Abp-TenantId") String AbpTenant,
                                             @Query("Id") String videoId);

    /**
     * 文章详情
     */
    @GET("/api/services/app/Edu_Course/Get")
    Observable<Response<ReaderBean>> getReader(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant,
                                               @Query("Id") String readerId);

    /**
     * 课程是否收藏
     */
    @POST("/api/services/app/Edu_Collection/Collected")
    Observable<Response<VideoCollectedBean>> isCollected(@Header("Abp.TenantId") String tenantId,
                                                         @Header("Authorization") String token,
                                                         @Header("Abp-TenantId") String AbpTenant,
                                                         @Query("memberId") String memberId,
                                                         @Query("courseId") String courseId);

    /**
     * 课程是否购买
     */
    @GET("/api/services/app/Edu_OrderHed/GetStatus")
    Observable<Response<IsBuyBean>> isBuy(@Header("Abp.TenantId") String tenantId,
                                          @Header("Authorization") String token,
                                          @Header("Abp-TenantId") String AbpTenant,
                                          @Query("memberId") String memberId,
                                          @Query("courseId") String courseId);

    /**
     * -------------------我的------------------
     * <p>
     * 个人信息
     */
    @GET("/api/services/app/Members/Get")
    Observable<Response<UserDataBean>> getUserData(@Header("Abp.TenantId") String tenantId,
                                                   @Header("Authorization") String token,
                                                   @Header("Abp-TenantId") String AbpTenant,
                                                   @Query("Id") String memberId);

    /**
     * 平台信息
     */
    @GET("api/services/app/Edu_Config/GetSimCfg")
    Observable<Response<ServiceBean>> getService(@Header("Abp.TenantId") String tenantId,
                                                 @Header("Authorization") String token,
                                                 @Header("Abp-TenantId") String AbpTenant);

    /**
     * 更新个人信息
     */
    @PUT("api/services/app/Members/Update")
    Observable<Response<BaseBean>> updateUserData(@Header("Abp.TenantId") String tenantId,
                                                  @Header("Authorization") String token,
                                                  @Header("Abp-TenantId") String AbpTenant,
                                                  @Body RequestBody requestBody);

    /**
     * 更改头像
     */
    @FormUrlEncoded
    @POST("/api/services/app/Members/UploadAvatar")
    Observable<Response<BaseBean>> uploadAvatar(@Header("Abp.TenantId") String tenantId,
                                                @Header("Authorization") String token,
                                                @Header("Abp-TenantId") String AbpTenant,
                                                @Field("memberId") String memberId,
                                                @Field("avatar") String avatar);

    /**
     * 收藏课程
     */
    @FormUrlEncoded
    @POST("/api/services/app/Members/Collect")
    Observable<Response<BaseBean>> collect(@Header("Abp.TenantId") String tenantId,
                                           @Header("Authorization") String token,
                                           @Header("Abp-TenantId") String AbpTenant,
                                           @Field("memberId") String memberId,
                                           @Field("courseId") String courseId);

    /**
     * 取消收藏课程
     */
    @DELETE("/api/services/app/Edu_Collection/Delete")
    Observable<Response<BaseBean>> deleteCollect(@Header("Abp.TenantId") String tenantId,
                                                 @Header("Authorization") String token,
                                                 @Header("Abp-TenantId") String AbpTenant,
                                                 @Query("memberId") String memberId,
                                                 @Query("id") String courseId);


    /**
     * 点赞课程
     */
    @FormUrlEncoded
    @POST("/api/services/app/Edu_Course/Like")
    Observable<Response<BaseBean>> like(@Header("Abp.TenantId") String tenantId,
                                        @Header("Authorization") String token,
                                        @Header("Abp-TenantId") String AbpTenant,
                                        @Field("memberId") String memberId,
                                        @Field("id") String courseId);

    /**
     * 收藏课程列表
     */
    @GET("/api/services/app/Edu_Collection/GetList")
    Observable<Response<UserLikeBean>> getCollect(@Header("Abp.TenantId") String tenantId,
                                                  @Header("Authorization") String token,
                                                  @Header("Abp-TenantId") String AbpTenant,
                                                  @Query("memberId") String memberId,
                                                  @Query("skipCount") int skipCount,
                                                  @Query("maxResultCount") int maxResultCount);

    /**
     * 通知提醒列表
     */
    @GET("/api/services/app/Edu_Message/GetList")
    Observable<Response<NoticeBean>> getNotice(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant,
                                               @Query("memberId") String memberId,
                                               @Query("skipCount") int skipCount,
                                               @Query("maxResultCount") int maxResultCount);

    /**
     * 签到详情
     */
    @GET("/api/services/app/Edu_SignIn/GetList")
    Observable<Response<SignBean>> getSign(@Header("Abp.TenantId") String tenantId,
                                           @Header("Authorization") String token,
                                           @Header("Abp-TenantId") String AbpTenant,
                                           @Query("memberId") String memberId,
                                           @Query("skipCount") int skipCount,
                                           @Query("maxResultCount") int maxResultCount);

    /**
     * 签到
     */
    @POST("/api/services/app/Edu_SignIn/SignIn")
    Observable<Response<BaseBean>> sign(@Header("Abp.TenantId") String tenantId,
                                        @Header("Authorization") String token,
                                        @Header("Abp-TenantId") String AbpTenant,
                                        @Query("memberId") String memberId,
                                        @Query("date") String date);

    /**
     * 充值
     */
    @PUT("/api/services/app/Members/UpdateBeans")
    Observable<Response<BaseBean>> recharge(@Header("Abp.TenantId") String tenantId,
                                            @Header("Authorization") String token,
                                            @Header("Abp-TenantId") String AbpTenant,
                                            @Query("memberId") String memberId,
                                            @Query("beans") int beans);

    /**
     * 我的vip产品
     */
    @GET("/api/services/app/Edu_Product/GetList")
    Observable<Response<UserProductBean>> getUserProduct(@Header("Abp.TenantId") String tenantId,
                                                         @Header("Authorization") String token,
                                                         @Header("Abp-TenantId") String AbpTenant,
                                                         @Query("memberId") String memberId,
                                                         @Query("skipCount") int skipCount,
                                                         @Query("maxResultCount") int maxResultCount);

    /**
     * 我的优惠券
     */
    @GET("/api/services/app/Edu_MyCoupon/GetList")
    Observable<Response<UserTicketBean>> getUserTicket(@Header("Abp.TenantId") String tenantId,
                                                       @Header("Authorization") String token,
                                                       @Header("Abp-TenantId") String AbpTenant,
                                                       @Query("memberId") String memberId,
                                                       @Query("skipCount") int skipCount,
                                                       @Query("maxResultCount") int maxResultCount);

    /**
     * 我的课程列表
     */
    @GET("/api/services/app/Edu_MyCourse/GetList")
    Observable<Response<UserLikeBean>> getCourse(@Header("Abp.TenantId") String tenantId,
                                                 @Header("Authorization") String token,
                                                 @Header("Abp-TenantId") String AbpTenant,
                                                 @Query("memberId") String memberId,
                                                 @Query("skipCount") int skipCount,
                                                 @Query("maxResultCount") int maxResultCount);

    /**
     * 宝宝列表
     */
    @GET("/api/services/app/Edu_Children/GetList")
    Observable<Response<UserChildBean>> getUserChild(@Header("Abp.TenantId") String tenantId,
                                                     @Header("Authorization") String token,
                                                     @Header("Abp-TenantId") String AbpTenant,
                                                     @Query("memberId") String memberId,
                                                     @Query("skipCount") int skipCount,
                                                     @Query("maxResultCount") int maxResultCount);

    /**
     * 添加宝宝
     */
    @POST("/api/services/app/Edu_Children/Create")
    Observable<Response<BaseBean>> addUserChild(@Header("Abp.TenantId") String tenantId,
                                                @Header("Authorization") String token,
                                                @Header("Abp-TenantId") String AbpTenant,
                                                @Body RequestBody requestBody);

    /**
     * 修改宝宝
     */
    @PUT("/api/services/app/Edu_Children/Update")
    Observable<Response<BaseBean>> updateUserChild(@Header("Abp.TenantId") String tenantId,
                                                   @Header("Authorization") String token,
                                                   @Header("Abp-TenantId") String AbpTenant,
                                                   @Body RequestBody requestBody);

    /**
     * 删除宝宝
     */
    @DELETE("/api/services/app/Edu_Children/Delete")
    Observable<Response<BaseBean>> deleteUserChild(@Header("Abp.TenantId") String tenantId,
                                                   @Header("Authorization") String token,
                                                   @Header("Abp-TenantId") String AbpTenant,
                                                   @Query("id") String childId);

    /**
     * 我的订单
     */
    @GET("/api/services/app/Edu_OrderHed/GetList")
    Observable<Response<OrderBean>> getOrder(@Header("Abp.TenantId") String tenantId,
                                             @Header("Authorization") String token,
                                             @Header("Abp-TenantId") String AbpTenant,
                                             @Query("memberId") String memberId,
                                             @Query("skipCount") int skipCount,
                                             @Query("maxResultCount") int maxResultCount);

    /**
     * 创建订单
     */
    @POST("/api/services/app/Edu_OrderHed/Create")
    Observable<Response<UpdateOrderBean>> updateOrder(@Header("Abp.TenantId") String tenantId,
                                                      @Header("Authorization") String token,
                                                      @Header("Abp-TenantId") String AbpTenant,
                                                      @Query("memberId") String memberId,
                                                      @Body RequestBody requestBody);

    /**
     * 改变订单状态
     */
    @POST("/api/services/app/Edu_OrderHed/BeansOrderNotify")
    Observable<Response<BaseBean>> updateOrderStatus(@Header("Abp.TenantId") String tenantId,
                                                     @Header("Authorization") String token,
                                                     @Header("Abp-TenantId") String AbpTenant,
                                                     @Query("orderNo") String orderId,
                                                     @Query("status") String status,
                                                     @Query("paymentMtd") String paymentMtd,
                                                     @Query("tradeType") String tradeType);

    /**
     * 我的报告列表
     */
    @GET("/api/services/app/Edu_Report/GetList")
    Observable<Response<ReportBean>> getReport(@Header("Abp.TenantId") String tenantId,
                                               @Header("Authorization") String token,
                                               @Header("Abp-TenantId") String AbpTenant,
                                               @Query("memberId") String memberId,
                                               @Query("skipCount") int skipCount,
                                               @Query("maxResultCount") int maxResultCount);
}